<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
<title>View Student Courses</title>
</head>
<style type="text/css">
th {text-align: right}
</style>
<body>

<?php include '../../top.html'; ?>
<?php include '../../authorization_check.php'; ?>
<?php include '../../checkStudentOnly.php'; ?>
<?php
	session_start();

	$studentID = $_SESSION['uname'];
	$year = $_SESSION['year'];
	$semester = $_SESSION['semester'];
	$programCode = $_SESSION['programCode'];
	$programName = $_SESSION['programShortName'];
?>

<p>
<?php

		
	require_once '../../commonutils/db/DBConnectionManager.php';

	$sqlquery = "select distinct * from termproject as t, section as s, course as c, instructor as i where  t.semesterID=".$year.$semester." and  t.sectionID=s.sectionID and t.semesterID=s.semesterID and s.courseCode=c.courseCode and s.instructorID=i.instructorID and t.programCode=".$programCode;
	
	//echo $sqlquery;
	$result = DBConnectionManager::query($sqlquery);

	if (mysql_num_rows($result) == 0)
	{
		echo "<br><center><h4>No term projects for ".$programName." program.</h4></center><br><br>";
	}
	else
	{
		echo "<center><h1>Term Projects</h1>";
		echo "<table border=\"1\" width=\"71%\" id=\"table1\">";
		echo "<tr>";
		echo "<td width=\"95\">Course Name</td>";
		echo "<td width=\"65\">Section</td>";
		echo "<td width=\"126\">Instructor</td>";
		echo "<td width=\"224\">Title</td>";
		echo "</tr>";

		while($row = mysql_fetch_assoc($result))
		{
			echo "<td width=\"95\">".$row['courseName']."</td>";
			echo "<td width=\"65\">".$row['sectionNumber']."</td>";
			echo "<td width=\"126\">".$row['firstname']." ".$row['lastname']."</td>";
			echo "<td width=\"224\">".$row['subject']."</td>";
			echo "</tr>";
		}	
		echo "</table>";
		echo "</center>";
	}
?>
</p>  

<br>
<hr color="blue">
<p>
<a href="../../StudentIndex.php"> Back </a>
</p>

</body>

</html>
